﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Model;
using BLL;
using Function;

namespace UI.AjxaFiles
{
    /// <summary>
    /// SetCoinPassword 的摘要说明
    /// </summary>
    public class SetCoinPassword : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string newpwd = context.Request.QueryString["newpwd"] ?? "";
            meseege msg = new meseege();
            //账户余额信息
            ST_InvestorMore investorModel = new ST_InvestorMore();
            investorModel = new ST_InvestorMoreBLL().GetModel(Method.CurrentUserID);
            investorModel.GetCoinPW = Method.GetMD5(newpwd, Function.Method.MD5EncryptBit.bit32);
            investorModel.GetCoinPwChanged = 2;
            if (new ST_InvestorMoreBLL().Update(investorModel))
            {
                msg.ok = true;
                msg.message = "提现密码设置成功，可以继续提现操作！";
            }
            else {
                msg.ok = true;
                msg.message = "提现密码设置失败！";
            }

            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}